remove auth gate for start - #2
Merged
Merged
Conversation
jlitola
approved these changes
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the MCP server is launched by an AI client (e.g. Claude Code via plugin), requireAuth() in startMcpServer throws AuthRequiredError and triggers process.exit(1) before the MCP handshake completes. The client sees a silent Connection closed error and never discovers any tools:
MCP server "plugin:githits:githits": Connection failed after 1467ms: MCP error -32000: Connection closedThis makes the Claude Code plugin completely non-functional for any user who hasn't already run githits login out-of-band.
Root Cause
requireAuth() was designed for interactive CLI commands where exiting with an auth message makes sense. For the MCP server, it kills the long-running process before the client can communicate with it — there's no opportunity to report the auth error back through the protocol.
Fix
Remove requireAuth() from startMcpServer and the corresponding AuthRequiredError catch blocks from both action handlers. Auth enforcement is not removed — it is already handled per-request by RefreshingGitHitsService.withTokenRefresh(), which throws AuthenticationError when no token is available. withErrorHandling() catches this and returns a structured isError tool result that the AI client can act on (e.g. running githits login automatically).
Changes
Related
See companion PR in githits-claude-code-plugin which updates SKILL.md to instruct Claude to auto-run githits login when it receives an auth error from a tool call.